using System;
using System.Collections.Generic;
using System.Text;
using Kaxaml.Properties;
using System.IO;

namespace Kaxaml.Documents
{
    class WpfDocument : XamlDocument
    {
        public WpfDocument(string folder) : base(folder)
		{
            InitializeSourceText(Settings.Default.WPFDefaultXAML);
		}

        public WpfDocument(string folder, string sourceText)
            : base(folder)
        {
            InitializeSourceText(sourceText);
        }

        public static WpfDocument FromFile(string fullPath)
        {
            if (File.Exists(fullPath))
            {
                string sourceText = File.ReadAllText(fullPath);

                WpfDocument document = new WpfDocument(Path.GetDirectoryName(fullPath), sourceText);
                document.FullPath = fullPath;

                return document;
            }

            return null;
        }
    }
}
